{extend name="extra@admin/content"}
{block name="content"}
<form class="layui-form layui-box" style='padding:25px 30px 20px 0' action="__SELF__" data-auto="true" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label">物料编码</label>
        <div class="layui-input-block">
            <input name="code" value='{$vo.code|default=""}'
                   required="required" title="请输入物料编码" placeholder="请输入物料编码" class="layui-input ">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">条码</label>
        <div class="layui-input-block">
            <input name="tiaoma" value='{$vo.tiaoma|default=""}'
                   required="required" title="请输入条码" placeholder="请输入条码" class="layui-input ">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">原料名称</label>
        <div class="layui-input-block">
            <input name="name" value='{$vo.name|default=""}'
                   required="required" title="请输入原料名称" placeholder="请输入原料名称" class="layui-input ">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">一级分类</label>
        <div class="layui-input-block">
            <select name="first_category" lay-verify="required" lay-filter="test" lay-search>
                <option value="">请选择一级分类</option>
                {volist name='category_one' id='v'}
                <option value="{$v.name}" {if condition="$vo.first_category eq $v.name"} selected {/if}>{$v.name}</option>
                {/volist}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">二级分类</label>
        <div class="layui-input-block">
            <select name="second_category" lay-verify="required" lay-filter="test" lay-search>
                <option value="">请选择二级分类</option>
                {volist name='category_two' id='v'}
                <option value="{$v.name}" {if condition="$vo.second_category eq $v.name"} selected {/if}>{$v.name}</option>
                {/volist}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">三级分类</label>
        <div class="layui-input-block">
            <select name="third_category" lay-verify="required" lay-filter="test" lay-search>
                <option value="">请选择三级分类</option>
                {volist name='category_three' id='v'}
                <option value="{$v.name}" {if condition="$vo.third_category eq $v.name"} selected {/if}>{$v.name}</option>
                {/volist}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">成本</label>
        <div class="layui-input-block">
            <input name="price" value='{$vo.price|default=""}'
                   required="required" title="请输入原料成本" placeholder="请输入原料成本" class="layui-input ">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">成本价</label>
        <div class="layui-input-block">
            <input name="chengben_price" value='{$vo.chengben_price|default=""}'
                   required="required" title="请输入原料成本价" placeholder="请输入原料成本价" class="layui-input ">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">比例结算</label>
        <div class="layui-input-block">
            <input type="radio"  name="is_signal" value="0"  title="是" {if $vo.is_signal eq 0} checked {/if}>
            <input type="radio"  name="is_signal" value="1"  title="否" {if $vo.is_signal eq 1} checked {/if}>
        </div>
        <span style="color:red;">注：选择是，就是按照千克计算成本，选择了否，就是按照原价计算成本（例如：袋子，选择否，按照原价计算）</span>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">单位</label>
        <div class="layui-input-block">
            <input name="unit" value='{$vo.unit|default=""}'
                   required="required" title="请输入单位" placeholder="请输入单位" class="layui-input ">
        </div>
    </div>
    <!--<div class="layui-form-item">-->
        <!--<label class="layui-form-label">基本计量数</label>-->
        <!--<div class="layui-input-block">-->
            <!--<input name="spec" value='{$vo.spec|default=""}'-->
                   <!--required="required" title="请输入基本计量数" placeholder="请输入基本计量数" class="layui-input ">-->
        <!--</div>-->
    <!--</div>-->
    <!--<div class="layui-form-item">-->
        <!--<label class="layui-form-label">包装</label>-->
        <!--<div class="layui-input-block">-->
            <!--<input name="pack" value='{$vo.pack|default=""}'-->
                   <!--required="required" title="请输入包装" placeholder="请输入包装" class="layui-input ">-->
        <!--</div>-->
    <!--</div>-->
    <div class="layui-form-item">
        <label class="layui-form-label">预警库存</label>    
        <div class="layui-input-block">
            {if $vo and isset($vo.warn_stock)}
            <input name="warn_stock" value='{$vo.warn_stock|default=""}'
                   required="required" title="请输入预警库存" placeholder="请输入预警库存" class="layui-input ">
            {else}
            <input name="warn_stock" value='{$vo.warn_stock|default=""}' required="required"
                   title="请输入预警库存" class="layui-input">
            {/if}
        </div>
    </div>
    <!--<div class="layui-form-item">-->
        <!--<label class="layui-form-label">允许自购</label>-->
        <!--<div class="layui-input-block">-->
            <!--{if $vo and isset($vo.pack)}-->
            <!--<input type="radio"  name="is_zigou" value="0"  title="不允许" {if condition="$vo.is_zigou eq 0"} checked {/if}>-->
            <!--<input type="radio"  name="is_zigou" value="1"  title="允许" {if condition="$vo.is_zigou eq 1"} checked {/if}>-->
            <!--{else}-->
            <!--<input type="radio"  name="is_zigou" value="0"  title="不允许"  checked >-->
            <!--<input type="radio"  name="is_zigou" value="1"  title="允许" }>-->
            <!--{/if}-->
        <!--</div>-->
    <!--</div>-->
    <div class="layui-form-item">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入备注，最多100个字符" maxlength="100" title="请输入备注" class="layui-textarea" name="remark">{$vo.remark|default=""}</textarea>
        </div>
    </div>
    <div class="hr-line-dashed"></div>
    <div class="layui-form-item text-center">
        {if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id'/>{/if}
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>
    <script>window.form.render();</script>
</form>
{/block}